package com.zhentao.controller;

import com.zhentao.dto.UserDto;
import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.pojo.User;
import com.zhentao.service.UserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
public class UserController {
    @Resource
    private UserService userService;
    @PostMapping("/login")
    public ResponseResult login(@RequestBody UserDto userDto){
        return userService.login(userDto);
    }
    @PostMapping("/add")
    public  ResponseResult add(@RequestBody User user){
        ResponseResult responseResult = userService.add1(user);
        return responseResult;
    }
}
